<template>
	<el-dialog title="代付详情" v-model="visible" :close-on-click-modal="false" draggable width="780px">
		<el-descriptions :column="2" border>
			<el-descriptions-item label-align="center" label="代付状态：">
				<el-tag v-if="rowInfo?.deliveryMethod === 20" type="success">开启</el-tag>
				<el-tag v-if="rowInfo?.deliveryMethod === 10" type="info">未开启</el-tag>
			</el-descriptions-item>
			<el-descriptions-item label-align="center" label="代付类型：" v-if="rowInfo.deliveryMethod === 20">
				<el-tag v-if="rowInfo.paymentType === 20" type="warning" size="small">短信</el-tag>
				<el-tag v-if="rowInfo.paymentType === 30" type="success" size="small">语音</el-tag>
				<div v-if="rowInfo.paymentType === 10">
					<el-tag type="warning" size="small">短信</el-tag>
					<el-tag type="success" class="ml-1" size="small">语音</el-tag>
				</div>
			</el-descriptions-item>
			<el-descriptions-item label-align="center" label="语音总限制：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 20"
				>{{ rowInfo?.ttsTotalLimit === 999999 ? '不限制' : rowInfo?.ttsTotalLimit + '(分钟)' }}
			</el-descriptions-item>
			<el-descriptions-item label-align="center" label="短信总限制：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 20">
				{{ rowInfo?.smsTotalLimit === 999999 ? '不限制' : rowInfo?.smsTotalLimit + '(条)' }}</el-descriptions-item
			>
			<el-descriptions-item label-align="center" label="语音日限：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 20">
				{{ rowInfo?.ttsSumDay === 999999 ? '不限制' : rowInfo?.ttsSumDay + '(分钟)' }}</el-descriptions-item
			>
			<el-descriptions-item label-align="center" label="短信日限：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 30">
				{{ rowInfo?.smsSumDay === 999999 ? '不限制' : rowInfo?.smsSumDay + '(条)' }}</el-descriptions-item
			>
			<el-descriptions-item label-align="center" label="语音月限：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 30">
				{{ rowInfo?.ttsSumMonth === 999999 ? '不限制' : rowInfo?.ttsSumMonth + '(分钟)' }}</el-descriptions-item
			>
			<el-descriptions-item label-align="center" label="短信月限：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 30">
				{{ rowInfo?.smsSumMonth === 999999 ? '不限制' : rowInfo?.smsSumMonth + '(条)' }}</el-descriptions-item
			>
			<el-descriptions-item label-align="center" label="语音代付截止时间：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 20">
				{{ rowInfo?.ttsExpirationDate === 999999 ? '不限制' : rowInfo?.ttsExpirationDate }}</el-descriptions-item
			>
			<el-descriptions-item label-align="center" label="短信代付截止时间：" v-if="rowInfo.deliveryMethod === 20 && rowInfo.paymentType !== 30">{{
				rowInfo?.smsExpirationDate
			}}</el-descriptions-item>
			<el-descriptions-item label-align="center" label="单位范围：">{{ rowInfo?.deptLimit === 10 ? '本级及子级' : '仅本级' }}</el-descriptions-item>
		</el-descriptions>
		<template #footer>
			<span class="dialog-footer">
				<el-button @click="visible = false">关闭</el-button>
			</span>
		</template>
	</el-dialog>
</template>

<script setup lang="ts" name="PaySetDialog">
import { payingDetails } from '/@/api/tariff/basicExpensesDeptDetail';

// 定义变量内容
const dataFormRef = ref();
const visible = ref(false);
const rowInfo: any = reactive({});

// 打开弹窗
const openDialog = (row: any) => {
	visible.value = true;
	// 重置表单数据
	nextTick(() => {
		dataFormRef.value?.resetFields();
	});
	payingDetails(row.deptId).then((res) => {
		Object.assign(rowInfo, res.data);
	});
};
// 暴露变量
defineExpose({
	openDialog,
});
</script>
